<template>
  <yd-layout class="m-protocol">
    <!-- 顶部导航 -->
    <yd-navbar slot="navbar" :title="title" height=".88rem" bgcolor="#fff" color="#444" fontsize=".3rem">
      <yd-navbar-back-icon slot="left" color="#666" @click.native="$router.back()"></yd-navbar-back-icon>
    </yd-navbar>

    <div class="m-detail-text" v-html="protocolContent"></div>
  </yd-layout>
</template>

<script>
  import { apiRegProtocol } from 'js/api'
  export default {
    data() {
      return {
        title: '',
        protocolContent: ''
      }
    },
    beforeRouteEnter(to, from, next) {
      next(vm => {
        const type = to.query.type
        switch (type) {
          case 'register':
            apiRegProtocol().then(data => {
              vm.title = '用户注册协议'
              vm.protocolContent = data.content
            })
            return
        }
      })
    }
  }
</script>

<style lang="scss">
</style>